package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zmo extends zbz {
   zmo() {
      this.c(60);
   }

   void a(byte[] var1, int var2, int var3) {
      this.a((short)var3);
      this.c = new byte[var3];
      System.arraycopy(var1, var2, this.c, 0, var3);
   }

   void a(String var1, zqa var2) throws Exception {
      boolean var3 = true;
      byte[] var4 = Encoding.getUnicode().a(var1);

      int var5;
      for(var5 = 0; var5 < var4.length / 2; ++var5) {
         if (var4[2 * var5 + 1] != 0) {
            var3 = false;
            break;
         }
      }

      int var6;
      if (var3) {
         byte[] var7 = new byte[var1.length()];

         for(var6 = 0; var6 < var1.length(); ++var6) {
            var7[var6] = var4[2 * var6];
         }

         var4 = var7;
      }

      var5 = 0;
      boolean var8 = false;

      while(true) {
         var6 = var4.length - var5;
         if (var6 + 1 <= 8224) {
            this.a((short)(var6 + 1));
            this.c = new byte[this.d()];
            this.c[0] = (byte)(var3 ? 0 : 1);
            System.arraycopy(var4, var5, this.c, 1, this.d() - 1);
            return;
         }

         if (var3) {
            this.a((short)8224);
            this.c = new byte[this.d()];
            this.c[0] = 0;
         } else {
            this.b(8223);
            this.c = new byte[this.d()];
            this.c[0] = 1;
         }

         System.arraycopy(var4, var5, this.c, 1, this.d() - 1);
         var5 += this.d() - 1;
         this.a(var2);
      }
   }

   void a(ArrayList var1) {
      this.a((short)(var1.size() * 8));
      this.c = new byte[this.d()];
      int var2 = 0;

      for(Iterator var3 = var1.iterator(); var3.hasNext(); var2 += 8) {
         zbsx var4 = (zbsx)var3.next();
         System.arraycopy(com.aspose.cells.b.a.zc.a(var4.a), 0, this.c, var2, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var4.b), 0, this.c, var2 + 2, 2);
      }

   }
}
